package day20210128;

import org.junit.Test;

public class RemovingElements {
    public int removeElement(int[] nums, int val) {
        int count = 0 ;
        for (int i = 0 ; i < nums.length-count ; i++) {
            if (nums[i]==val) {
                for (int o = i ; i < nums.length-1-count ; i++ ) {
                    nums[i] = nums[i+1];
                }
                count++ ;
            }
        }
        return nums.length - count;
    }

    @Test
    public void test01() {
        int[] nums = new int[]{3, 2, 3, 3};
        int val = 3;
        int i = removeElement(nums, val);
        System.out.println(i);
    }
}
